<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>重设密码 <!--{$site.title}-->_<!--{$site.seotitle}--></title>
    <meta name="keywords" content="<!--{$site.keywords}-->" />
    <meta name="description" content="<!--{$site.description}-->"/>
    <meta name="mobile-agent" content="format=html5;url=<!--{$site.url}-->"/>
    <!--{iCMS:public:ui}-->
    <link rel="stylesheet" href="<!--{$site.urls.ui}-->/iCMS.loginreg-6.0.0.css" type="text/css" />
    <script>
    $(function(){
      $("#iCMS_resetpwd").click(function(event) {
        var password = $('input[name="password"]').val();
        if (password.length < 6) {
          iCMS.alert("新密码太短啦，至少要6位哦");
          return false;
        }

        var rstpassword = $('input[name="rstpassword"]').val();
        if (rstpassword.length < 6) {
          iCMS.alert("确认密码太短啦，至少要6位哦");
          return false;
        }
        if (password != rstpassword) {
          iCMS.alert("新密码与确认密码不一致！");
          return false;
        }

        var seccode = $('input[name="seccode"]').val();
        if (!seccode) {
          $('input[name="seccode"]').focus();
          iCMS.alert("请填写验证码！");
          return false;
        }
        var param = {'action':'findpwd','uid':'<!--{$user.uid}-->','auth':$('input[name="auth"]').val(),'seccode':seccode,'password':password,'rstpassword':rstpassword}
        $.post(iCMS.api('user'), param, function(ret) {
          if (ret.code) {
            alert(ret.msg);
            window.top.location.href = '<!--{iCMS:router url='/api/user/login'}-->';
          } else {
            iCMS.alert(ret.msg);
          }
        }, 'json');
      });
    })
    </script>
  </head>
  <body class="iCMS_findpwd_wrap">
    <div class="findpwd_wrap">
      <div class="logo"> <a href="<!--{$site.url}-->" class="iCMS fl" title="<!--{$site.title}-->"><!--{$site.title}--></a> </div>
      <div class="content">
        <div class="main-col">
          <h1>重设密码</h1>
          <div class="rl_center">
            <div id="iCMS-findpwd-page" class="rl_form">
              <div class="lg_name" style="margin-left: 50px;"> <span>邮箱：</span>
                <!--{$user.username}-->
              </div>
              <div class="clear"></div>
              <div class="lg_name" style="margin-left: 50px;"> <span>昵称：</span>
                <!--{$user.nickname}-->
              </div>
              <div class="clear"></div>
              <div class="reg_password" style="margin-left: 36px;"> <span>新密码：</span>
                <input style="*margin-left:-1px;" maxlength="36" type="password" name="password" class="text">
              </div>
              <div class="clear"></div>
              <div class="reg_respassword"> <span>确认密码：</span>
                <input type="password" maxlength="36" name="rstpassword" class="text">
              </div>
              <div class="clear"></div>
              <div class="lg_check"><span>验证码：</span>
                <input type="text" maxlength="4" name="seccode" class="iCMS_findpwd_seccode iCMS_seccode">
                <img src="<!--{iCMS:router url='/api/public/seccode'}-->" alt="验证码" class="iCMS_seccode_img r3"/>
                <a href="javascript:;" class="iCMS_seccode_text" style="float: none">换一张</a>
              </div>
              <div class="err_seccode"><span><i class="fa fa-minus-circle"></i> 请输入验证码</span></div>
              <div class="clear"></div>
              <input name="auth" type="hidden" value="<!--{$auth}-->" />
              <button class="btn btn-large btn-primary" id="iCMS_resetpwd" type="button">重设密码</button>
            </div>
          </div>
        </div>
        <div class="clearfix"></div>
      </div>
    </div>
    <!--{include file="{iTPL}/footer.htm"}-->
  </body>
</html>
